package com.msti.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQuery;
import javax.persistence.OneToMany;

@Entity
public class Student {

	private String studentID;
	private String fullName;
	private String NICNO;
	private String address;
	private String PassportNo;
	private String CDCNO;
	private String phone;
	private Date dateOfBirth;
	//private long eId; 
	private String pictureURL;
	private Employee employee;
	private List<Batch> batch = new ArrayList<Batch>();
	private List<Certificate> certificates = new ArrayList<Certificate>();
	
	@ManyToMany(targetEntity=Batch.class, mappedBy="students",
	        cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	public List<Batch> getBatch() {
		return batch;
	}

	public void setBatch(List<Batch> b) {
		this.batch = b;
	}

	@ManyToOne
	@JoinColumn(name= "employeeId")
	public Employee getEmployee() {
		return employee;
	}
	
	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	@Id
	public String getStudentID() {
		return studentID;
	}
	public void setStudentID(String studentID) {
		this.studentID = studentID;
	}
	public String getFullName() {
		return fullName;
	}
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
	public String getNICNO() {
		return NICNO;
	}
	public void setNICNO(String nICNO) {
		NICNO = nICNO;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPassportNo() {
		return PassportNo;
	}
	public void setPassportNo(String passportNo) {
		PassportNo = passportNo;
	}
	public String getCDCNO() {
		return CDCNO;
	}
	public void setCDCNO(String cDCNO) {
		CDCNO = cDCNO;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public Date getDateOfBirth() {
		return dateOfBirth;
	}
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	/*public long geteId() {
		return eId;
	}
	public void seteId(long eId) {
		this.eId = eId;
	}*/
	public String getPictureURL() {
		return pictureURL;
	}
	public void setPictureURL(String pictureURL) {
		this.pictureURL = pictureURL;
	}

	public void setCertificates(List<Certificate> certificates) {
		this.certificates = certificates;
	}

	@OneToMany(targetEntity=Certificate.class, mappedBy="student",
	        cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	public List<Certificate> getCertificates() {
		return certificates;
	}
	
	
	
}
